/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaModificar.java
 *
 * Created on May 14, 2012, 1:10:27 PM
 */

package programita;

import busquedas.Busquedas;
import busquedas.CodificarCursos;
import busquedas.DecodificarCursos;
import busquedas.Modificar;
import java.util.ArrayList;
import javax.swing.JOptionPane;

/**
 *
 * @author educacionit
 */
public class VentanaModificar extends javax.swing.JFrame {
    private Alumno alumno;

    /** Creates new form VentanaModificar */
    public VentanaModificar() {
        initComponents();
    }
   public VentanaModificar(Alumno al) {
        initComponents();
        alumno=al;
        radioNombre.setSelected(true);
        validadorRadios();
        comboCurso.addItem("Seleccione..");
        comboCurso.addItem("Jardin");
        comboCurso.addItem("Primaria");
        comboCurso.addItem("Ingles");
        comboCurso.addItem("Sala Recup");
        comboDivision.addItem("Seleccione..");
        labelNombreA.setText("Nombre actual: " +al.getNombre());
        labelNombreAp.setText("Apellido actual: "+al.getApellido());
        labelNivelA.setText("El alumno se encuentra actualmente en: "+DecodificarCursos.decodificar(al.getGrado())+" en la division: "+al.getDivision());
        Busquedas busq=new Busquedas();
        ArrayList<Tutor> tutores= busq.buscarTutor(al.getId());
        for(int i=0;i<tutores.size();i++){
            Tutor mengano=tutores.get(i);
        labelTutor.setText(mengano.toString());
        al.setTut(mengano);
       }
    }

    public Alumno getAlumno() {
        return alumno;
    }

    public void setAlumno(Alumno alumno) {
        this.alumno = alumno;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextField2 = new javax.swing.JTextField();
        buttonGroup1 = new javax.swing.ButtonGroup();
        textNombre = new javax.swing.JTextField();
        textApellido = new javax.swing.JTextField();
        comboCurso = new javax.swing.JComboBox();
        radioNombre = new javax.swing.JRadioButton();
        radioCurso = new javax.swing.JRadioButton();
        radioApellido = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        comboDivision = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        labelNombreA = new javax.swing.JLabel();
        labelNombreAp = new javax.swing.JLabel();
        labelNivelA = new javax.swing.JLabel();
        BotonModificar = new javax.swing.JButton();
        BotonVolver = new javax.swing.JButton();
        comboDivisionDelCurso = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        radioTutorN = new javax.swing.JRadioButton();
        labelTutor = new javax.swing.JLabel();
        textTutorApe = new javax.swing.JTextField();
        textTutorNomb = new javax.swing.JTextField();
        radioTutorAp = new javax.swing.JRadioButton();

        jTextField2.setText("jTextField2");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        textNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textNombreActionPerformed(evt);
            }
        });

        textApellido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textApellidoActionPerformed(evt);
            }
        });

        comboCurso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboCursoActionPerformed(evt);
            }
        });

        buttonGroup1.add(radioNombre);
        radioNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioNombreActionPerformed(evt);
            }
        });

        buttonGroup1.add(radioCurso);
        radioCurso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioCursoActionPerformed(evt);
            }
        });

        buttonGroup1.add(radioApellido);
        radioApellido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioApellidoActionPerformed(evt);
            }
        });

        comboDivision.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboDivisionActionPerformed(evt);
            }
        });

        jLabel1.setText("Nombre");

        jLabel2.setText("Apellido");

        jLabel3.setText("Nivel");

        jLabel4.setText("Curso");

        labelNombreA.setText("Lalalala");

        labelNombreAp.setText("Lalalala");

        labelNivelA.setText("Lalalala");

        BotonModificar.setText("Modificar");
        BotonModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonModificarActionPerformed(evt);
            }
        });

        BotonVolver.setText("Atras");
        BotonVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonVolverActionPerformed(evt);
            }
        });

        jLabel5.setText("Division");

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel6.setText("Apellido");

        jLabel7.setText("Nombre Tutor");

        buttonGroup1.add(radioTutorN);
        radioTutorN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioTutorNActionPerformed(evt);
            }
        });

        labelTutor.setText("No tiene tutor asignado");

        buttonGroup1.add(radioTutorAp);
        radioTutorAp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioTutorApActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(2, 2, 2)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(radioTutorN)
                .addGap(8, 8, 8)
                .addComponent(textTutorNomb, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioTutorAp)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textTutorApe, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(97, 97, 97))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(236, Short.MAX_VALUE)
                .addComponent(labelTutor, javax.swing.GroupLayout.PREFERRED_SIZE, 344, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(labelTutor)
                .addGap(19, 19, 19)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(radioTutorN)
                    .addComponent(jLabel7)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(textTutorNomb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(textTutorApe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel6))
                    .addComponent(radioTutorAp))
                .addContainerGap(10, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 508, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(BotonVolver, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)
                        .addComponent(BotonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(37, 37, 37))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jRadioButton4)
                                .addGap(27, 27, 27))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(radioNombre)
                            .addComponent(radioCurso)
                            .addComponent(radioApellido)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelNombreA, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
                            .addComponent(labelNombreAp, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
                            .addComponent(labelNivelA, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addComponent(comboDivision, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jLabel5)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(comboDivisionDelCurso, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addComponent(comboCurso, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(textApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(textNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(labelNombreA)
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1)
                            .addComponent(radioNombre))
                        .addGap(5, 5, 5)
                        .addComponent(labelNombreAp)))
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelNivelA)))
                    .addComponent(radioApellido))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(radioCurso)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel4))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(comboCurso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(comboDivision, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5)
                            .addComponent(comboDivisionDelCurso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel3))
                .addGap(21, 21, 21)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotonModificar)
                    .addComponent(BotonVolver))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void validadorRadios(){
        if(radioNombre.isSelected()){
            textNombre.setEnabled(true);
            textApellido.setEnabled(false);
            comboCurso.setEnabled(false);
            comboDivision.setEnabled(false);
            textTutorNomb.setEnabled(true);
            textTutorApe.setEnabled(true);
        }else if(radioApellido.isSelected()){
                textApellido.setEnabled(true);
                textNombre.setEnabled(false);
                comboCurso.setEnabled(false);
                comboDivision.setEnabled(false);
                textTutorNomb.setEnabled(false);
                textTutorApe.setEnabled(false);
            }else if(radioCurso.isSelected()){
                    comboCurso.setEnabled(true);
                    comboDivision.setEnabled(true);
                    comboDivisionDelCurso.setEnabled(true);
                    textApellido.setEnabled(false);
                    textNombre.setEnabled(false);
                    textTutorNomb.setEnabled(false);
                    textTutorApe.setEnabled(false);
                }else if(radioTutorN.isSelected()){
                    textTutorNomb.setEnabled(true);
                    textApellido.setEnabled(false);
                    textNombre.setEnabled(false);
                    comboCurso.setEnabled(false);
                    comboDivision.setEnabled(false);
                    textTutorApe.setEnabled(false);

                    }else if(radioTutorAp.isSelected()){
                        textTutorApe.setEnabled(true);
                        textApellido.setEnabled(false);
                        textNombre.setEnabled(false);
                        comboCurso.setEnabled(false);
                        comboDivision.setEnabled(false);
                        textTutorNomb.setEnabled(false);
                    }


    }

   
    private void textNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textNombreActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textNombreActionPerformed

    private void radioNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioNombreActionPerformed
    validadorRadios();
    }//GEN-LAST:event_radioNombreActionPerformed

    private void textApellidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textApellidoActionPerformed
     
    }//GEN-LAST:event_textApellidoActionPerformed

    private void radioApellidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioApellidoActionPerformed
    validadorRadios();        
    }//GEN-LAST:event_radioApellidoActionPerformed

    private void radioCursoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioCursoActionPerformed
     validadorRadios();
    }//GEN-LAST:event_radioCursoActionPerformed

    private void comboDivisionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboDivisionActionPerformed

    }//GEN-LAST:event_comboDivisionActionPerformed

    private void comboCursoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboCursoActionPerformed

        String seleccion=(String)comboCurso.getSelectedItem();
         System.out.println("seleccion:"+seleccion);
                if(seleccion.equals("Jardin")){
                comboDivision.removeAllItems();
                comboDivisionDelCurso.removeAllItems();
                comboDivisionDelCurso.setVisible(true);
                comboDivision.setVisible(true);
                comboDivisionDelCurso.addItem("Seleccione..");
                comboDivision.addItem("Seleccione..");
                comboDivision.addItem("Sala Roja");
                comboDivision.addItem("Sala Verde");
                comboDivision.addItem("Sala Azul");
                comboDivisionDelCurso.addItem("A");
                comboDivisionDelCurso.addItem("B");


            }else if(seleccion.equals("Primaria")){

                    comboDivision.removeAllItems();
                    comboDivisionDelCurso.removeAllItems();
                    comboDivisionDelCurso.setVisible(true);
                    comboDivision.setVisible(true);
                    comboDivisionDelCurso.addItem("Seleccione..");
                    comboDivision.addItem("Seleccione..");
                    comboDivision.addItem("Primer Grado");
                    comboDivision.addItem("Segundo Grado");
                    comboDivision.addItem("Tercer Grado");
                    comboDivision.addItem("Cuarto Grado");
                    comboDivision.addItem("Quinto Grando");
                    comboDivision.addItem("Sexto Grado");
                    comboDivision.addItem("Septimo Grado");
                    comboDivisionDelCurso.addItem("A");
                    comboDivisionDelCurso.addItem("B");
                    comboDivisionDelCurso.addItem("C");
                    comboDivisionDelCurso.addItem(" ");

                    }else if(seleccion.equals("Ingles")){
                    comboDivision.removeAllItems();
                    comboDivisionDelCurso.removeAllItems();
                    comboDivision.addItem("Seleccione..");
                    comboDivisionDelCurso.addItem("Seleccione..");
                    comboDivision.setVisible(true);
                    comboDivision.addItem("Primer Nivel");
                    comboDivision.addItem("Segundo Nivel");
                    comboDivision.addItem("Tercer Nivel");
                    comboDivision.addItem("Cuarto Nivel");
                    comboDivision.addItem("Quinto Nivel");
                    comboDivision.addItem("Sexto Nivel");
                    comboDivisionDelCurso.setVisible(true);
                    comboDivisionDelCurso.addItem("1");
                    comboDivisionDelCurso.addItem("2");
                    comboDivisionDelCurso.addItem("3");
                     }else{
                        comboDivision.setVisible(false);
                        comboDivisionDelCurso.setVisible(false);
                    }

    }//GEN-LAST:event_comboCursoActionPerformed

    private void BotonVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonVolverActionPerformed
        VentanaModificarEliminar vent=new VentanaModificarEliminar();
        this.setVisible(false);
        vent.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_BotonVolverActionPerformed

    private void radioTutorNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioTutorNActionPerformed
       validadorRadios();
    }//GEN-LAST:event_radioTutorNActionPerformed

        public void ModificarCurso(){

        try{
        int curso;
        Modificar modif=new Modificar();
        
            if(comboCurso.getSelectedItem().equals("Sala Recup")){
                curso=50;
                JOptionPane.showMessageDialog(null, "No se puede modificar el curso de un Alumno de Sala recuperacion.Eliminelo y agregue al mismo alumno para realizar dicha accion", "Notificacion", JOptionPane.INFORMATION_MESSAGE);

                System.out.println("No se puede modificar el curso de un alumno de sala de recup");
            }else if(comboCurso.getSelectedItem().equals("Ingles")){
                 curso=CodificarCursos.Codificar((String)comboCurso.getSelectedItem(), (String)comboDivision.getSelectedItem());
                 modif.ModCursoIngles(curso,(String)comboDivisionDelCurso.getSelectedItem(),alumno.getId());
                 alumno.setGrado(curso);
                 alumno.setDivision((String)comboDivisionDelCurso.getSelectedItem());
                 System.out.println("Realizo la modificacion de curso de Ingles con exito");
            } else{
                 curso=CodificarCursos.Codificar((String)comboCurso.getSelectedItem(), (String)comboDivision.getSelectedItem());
                 modif.ModCursoPrimJard(curso,(String)comboDivisionDelCurso.getSelectedItem(),alumno.getId());
                 alumno.setGrado(curso);
                 alumno.setDivision((String)comboDivisionDelCurso.getSelectedItem());
                 System.out.println("Realizo la modificacion de Jardin y Primaria");
            }
        
        }catch(Exception e){
            e.printStackTrace();
            JOptionPane.showMessageDialog(this, "No modifico nada");
        }finally{
        }
        
    }
    private void BotonModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonModificarActionPerformed
        Modificar mod= new Modificar();
        try{
         if(radioNombre.isSelected()){
          mod.modificarAlumnoNombre(alumno.getId(),textNombre.getText());
          alumno.setNombre(textNombre.getText());
        }else if(radioApellido.isSelected()){
            mod.modificarAlumnoApellido(alumno.getId(),textApellido.getText());
            alumno.setApellido(textNombre.getText());
            }else if(radioCurso.isSelected()){
                 ModificarCurso();
                }else if(radioTutorN.isSelected()){
                 String nuevoNombreTutor=textTutorNomb.getText();
                 alumno.getTut().setNombre(nuevoNombreTutor);
                 mod.modificarAlumnoTutoresNombre(alumno.getId(), nuevoNombreTutor);  
                    }else if(radioTutorAp.isSelected()){
                    String nuevoApeTutor = textTutorApe.getText();
                    alumno.getTut().setApellido(nuevoApeTutor);
                    mod.modificarAlumnoApellido(alumno.getId(), nuevoApeTutor);
                    }

        JOptionPane.showMessageDialog(null, "Alumno modificado con exito", "Notificacion", JOptionPane.INFORMATION_MESSAGE);
        VentanaModificar vent=new VentanaModificar(alumno);
        this.setVisible(false);
        vent.setVisible(true);
        this.dispose();
        }catch(Exception e){
            JOptionPane.showMessageDialog(null, "El Alumno no se pudo modificar","Notificacion",JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
        }
    }//GEN-LAST:event_BotonModificarActionPerformed

    private void radioTutorApActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioTutorApActionPerformed
       validadorRadios();
    }//GEN-LAST:event_radioTutorApActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaModificar().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonModificar;
    private javax.swing.JButton BotonVolver;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox comboCurso;
    private javax.swing.JComboBox comboDivision;
    private javax.swing.JComboBox comboDivisionDelCurso;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JLabel labelNivelA;
    private javax.swing.JLabel labelNombreA;
    private javax.swing.JLabel labelNombreAp;
    private javax.swing.JLabel labelTutor;
    private javax.swing.JRadioButton radioApellido;
    private javax.swing.JRadioButton radioCurso;
    private javax.swing.JRadioButton radioNombre;
    private javax.swing.JRadioButton radioTutorAp;
    private javax.swing.JRadioButton radioTutorN;
    private javax.swing.JTextField textApellido;
    private javax.swing.JTextField textNombre;
    private javax.swing.JTextField textTutorApe;
    private javax.swing.JTextField textTutorNomb;
    // End of variables declaration//GEN-END:variables

}
